package com.xhwl.logistics.service.cent.server;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhwl.common.dto.cent.vehicle.feign.VehiclePayRecordQuery;
import com.xhwl.logistics.bo.VehiclePayRecordBO;
import com.xhwl.logistics.bo.input.PageBO;
import com.xhwl.logistics.bo.input.QueryVehiclePayRecordBO;
import com.xhwl.logistics.converter.ToPageBO;
import com.xhwl.logistics.converter.ToPageVO;
import com.xhwl.logistics.converter.ToQueryVehiclePayRecordBO;
import com.xhwl.logistics.converter.ToVehiclePayRecordVO;
import com.xhwl.logistics.converter.mapstruct.VehiclePayRecordConverter;
import com.xhwl.logistics.service.IVehiclePayRecordService;
import com.xhwl.logistics.vo.PageVO;
import com.xhwl.logistics.vo.VehiclePayRecordVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
//@Service
public class VehiclePayRecordFeignServiceImpl implements IVehiclePayRecordFeignService{

    @Autowired
    private ToQueryVehiclePayRecordBO toQueryVehiclePayRecordBO;

    @Autowired
    private IVehiclePayRecordService vehiclePayRecordService;

    @Autowired
    private ToVehiclePayRecordVO toVehiclePayRecordVO;

    @Autowired
    private ToPageVO toPageVO;

    @Autowired
    private ToPageBO toPageBO;
    @Autowired
    private VehiclePayRecordConverter vehiclePayRecordConverter;

    @Override
    public PageVO<VehiclePayRecordVO> pagePayRecord(VehiclePayRecordQuery vehiclePayRecordQuery) {
        QueryVehiclePayRecordBO queryVehiclePayRecordBO = toQueryVehiclePayRecordBO.vehiclePayRecordQuery2QueryVehiclePayRecordBO(vehiclePayRecordQuery);
        PageBO pageBO = toPageBO.toPageBO(vehiclePayRecordConverter.vehiclePayRecordQuery2PageDTO(vehiclePayRecordQuery));
        Page<VehiclePayRecordBO> vehiclePayRecordBOPage = vehiclePayRecordService.pagePayRecord(queryVehiclePayRecordBO, pageBO);

        PageVO<VehiclePayRecordVO> pageVO = toPageVO.toPageVO(vehiclePayRecordBOPage, toVehiclePayRecordVO.toVehiclePayRecordVOList(vehiclePayRecordBOPage.getRecords()));
        return pageVO;
    }
}